package service.Impl;

import dao.AppointmentRuleDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import pojo.AppointmentRule;
import service.AppointmentRuleService;
import java.util.List;

@Service
public class AppointmentRuleServiceimpl implements AppointmentRuleService {

    @Autowired
    private AppointmentRuleDao appointmentRuleDao;

    @Override
    public int addRule(AppointmentRule rule) {
        return appointmentRuleDao.insert(rule);
    }

    @Override
    public int updateRule(AppointmentRule rule) {
        return appointmentRuleDao.update(rule);
    }

    @Override
    public int deleteRule(Integer ruleId) {
        return appointmentRuleDao.delete(ruleId);
    }

    @Override
    public AppointmentRule getRuleById(Integer ruleId) {
        return appointmentRuleDao.selectById(ruleId);
    }

    @Override
    public List<AppointmentRule> getAllRules() {
        return appointmentRuleDao.selectAll();
    }

    @Override
    public List<AppointmentRule> getRulesByRuleName(String ruleName) {
        return appointmentRuleDao.selectByRuleName(ruleName);
    }
}

